package com.sunwayhorizo.health.hl7.factories;

import com.sunwayhorizo.health.hl7.common.Hl7Exception;
import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.CE;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.SET_II;
import com.sunwayhorizo.health.hl7.rim.Access;
import com.sunwayhorizo.health.hl7.rim.Employee;
import com.sunwayhorizo.health.hl7.rim.Hl7Entity;
import com.sunwayhorizo.health.hl7.rim.LicensedEntity;
import com.sunwayhorizo.health.hl7.rim.Patient;
import com.sunwayhorizo.health.hl7.rim.Role;
import com.sunwayhorizo.health.hl7.vocabulary.RoleClass;
import com.sunwayhorizo.health.hl7.vocabulary.RoleCode;

//            FactoryValidation

public class RoleFactoryImpl extends RoleFactory
{

    public static final String RCS_ID = "$Header: RoleFactoryImpl.java 1.0 2006/12/08 09:16:38 amchanda noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(
        "$Header: RoleFactoryImpl.java 1.0 2006/12/08 09:16:38 amchanda noship $", "com.sunwayhorizo.health.facade.factories.comm");
    // private RimServiceBean session;
    private FactoryValidation validation;
    private DataTypeFactory dataTypeFactory;


    public RoleFactoryImpl()
    {
    }


    // public RoleFactoryImpl(ServiceLocator servicelocator)
    // throws Hl7Exception
    // {
    // // session = (RimServiceBean)servicelocator.getRimService();
    // dataTypeFactory = DataTypeFactory.getInstance(servicelocator);
    // // validation = new FactoryValidation(session);
    // }

    public Role newRole(CS cs, CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Object obj = null;
        if (cs == null || cs.isNull().isTrue())
            throw validation.newParameterMissingException("roleClass");
        if (cs.equal(RoleClass.PART).isTrue())
            obj = newPart(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.HLTHCHRT).isTrue())
            obj = newHealthChart(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.INST).isTrue())
            obj = newInstance(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.MNT).isTrue())
            obj = newMaintainedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SDLOC).isTrue())
            obj = newServiceDeliveryLocation(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.LOCE).isTrue())
            obj = newLocatedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ISDLOC).isTrue())
            obj = newIncidentalServiceDeliveryLocation(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SUBY).isTrue())
            obj = newSubsumedBy(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PAYEE).isTrue())
            obj = newPayee(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.EMP).isTrue())
            obj = newEmployee(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.BASE).isTrue())
            obj = newBaseIngredient(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.NOT).isTrue())
            obj = newNotaryPublic(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.OWN).isTrue())
            obj = newOwnedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PROV).isTrue())
            obj = newHealthcareProvider(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SPNSR).isTrue())
            obj = newSponsor(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.EXPR).isTrue())
            obj = newExposedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CRINV).isTrue())
            obj = newResearchInvestigator(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.INVSBJ).isTrue())
            obj = newInvestigatedSubject(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CONT).isTrue())
            obj = newContent(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.GUAR).isTrue())
            obj = newGuarantor(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.GRIC).isTrue())
            obj = newGeneric(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.STOR).isTrue())
            obj = newStoredEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.RGRP).isTrue())
            obj = newRegulatedProduct(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.RET).isTrue())
            obj = newRetailedMaterial(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.WRTE).isTrue())
            obj = newWarrantedProduct(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ECON).isTrue())
            obj = newEmergencyContact(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CRSPNSR).isTrue())
            obj = newResearchSponsor(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CON).isTrue())
            obj = newContact(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.RESBJ).isTrue())
            obj = newResearchSubject(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.MBR).isTrue())
            obj = newMember(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.STBL).isTrue())
            obj = newStabilizer(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.DST).isTrue())
            obj = newDistributedMaterial(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.TERR).isTrue())
            obj = newTerritory(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.STD).isTrue())
            obj = newStudent(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CAREGIVER).isTrue())
            obj = newCareGiver(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.GUARD).isTrue())
            obj = newGuardian(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CASESBJ).isTrue())
            obj = newCaseSubject(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.THER).isTrue())
            obj = newTherapeuticAgent(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.NOK).isTrue())
            obj = newNextOfKin(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.DSDLOC).isTrue())
            obj = newDedicatedServiceDeliveryLocation(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.POLHOLD).isTrue())
            obj = newPolicyHolder(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ISLT).isTrue())
            obj = newIsolate(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PRS).isTrue())
            obj = newPersonalRelationship(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ACTM).isTrue())
            obj = newActiveMoiety(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.UNDWRT).isTrue())
            obj = newUnderwriter(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ASSIGNED).isTrue())
            obj = newAssignedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.CIT).isTrue())
            obj = newCitizen(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PRSV).isTrue())
            obj = newPreservative(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SGNOFF).isTrue())
            obj = newSigningAuthority(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ACCESS).isTrue())
            obj = newAccess(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ALQT).isTrue())
            obj = newAliquot(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.GEN).isTrue())
            obj = newGeneralization(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.MIL).isTrue())
            obj = newMilitaryPerson(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.IACT).isTrue())
            obj = newInactiveIngredient(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PAYOR).isTrue())
            obj = newPayor(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.MANU).isTrue())
            obj = newManufacturedProduct(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ADTV).isTrue())
            obj = newAdditive(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.FLVR).isTrue())
            obj = newFlavorAdditive(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.ACTI).isTrue())
            obj = newActiveIngredient(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SUBS).isTrue())
            obj = newSubsumer(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.LIC).isTrue())
            obj = newLicensedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.IDENT).isTrue())
            obj = newIdentifiedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.COVPTY).isTrue())
            obj = newCoveredParty(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.SPEC).isTrue())
            obj = newSpecimen(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.BIRTHPL).isTrue())
            obj = newBirthplace(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.INGR).isTrue())
            obj = newIngredient(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.COLR).isTrue())
            obj = newColorAdditive(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.AGNT).isTrue())
            obj = newAgent(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.QUAL).isTrue())
            obj = newQualifiedEntity(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.PAT).isTrue())
            obj = newPatient(ce, entity, entity1, set_ii);
        else if (cs.equal(RoleClass.HLD).isTrue())
        {
            obj = newHeldEntity(ce, entity, entity1, set_ii);
        }
        else if (cs.equal(RoleCode.TEMPCLASS).isTrue())
        { // 增加根据模板类型编码创建模板类型角色
            obj = newTempClassRole(ce, entity, entity1, set_ii);
        }
        else if (cs.equal(RoleCode.TEMPFILE).isTrue())
        { // 增加根据模板类型编码创建模板类型角色
            obj = newTempFileRole(ce, entity, entity1, set_ii);
        }
        else
        {
            obj = new Role();
            ((Role) obj).setClassCode(cs);

            /*
             * if(set_ii == null || set_ii.isNull().isTrue() ||
             * set_ii.isEmpty().isTrue()) { ((Role)obj).setId(
             * dataTypeFactory.newSET_II(session.getNextII())); } else {
             * validation.validateOID(set_ii); ((Role)obj).setId(
             * set_ii.union(session.getNextII())); }
             */
            ((Role) obj).setCode(ce);
            ((Role) obj).setPlayerEntity(entity);
            ((Role) obj).setScoperEntity(entity1);
        }
        return ((Role) (obj));
    }


    public Role newIdentifiedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.IDENT);
        // role.setId(set_ii);
        return role;
    }


    @Override
    public Role newRole(CS classCode, CE roleCode, Hl7Entity entity, Hl7Entity entity1) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(roleCode);
        role.setClassCode(classCode);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        return role;
    }


    /**
     * 模板类型角色 <br>
     * 作者 jinzw <br>
     * 创建日期 2010-12-15 <br>
     * 
     * @param ce
     * @param entity
     * @param entity1
     * @param set_ii
     * @return
     * @throws Hl7Exception
     *             Role
     */
    public Role newTempClassRole(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        role.setClassCode(RoleClass.PART);
        // role.setId(set_ii);
        return role;
    }


    /**
     * 板文件角色创建 <br>
     * 作者 jinzw <br>
     * 创建日期 2010-12-16 <br>
     * 
     * @param ce
     * @param entity
     * @param entity1
     * @param set_ii
     * @return
     * @throws Hl7Exception
     *             Role
     */
    public Role newTempFileRole(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        role.setClassCode(RoleClass.PART);
        // role.setId(set_ii);
        return role;
    }


    public Patient newPatient(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Patient patient = new Patient();
        patient.setCode(ce);
        patient.setPlayerEntity(entity);
        patient.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { patientimpl.setAttribute("Id",
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); patient.setAttribute("Id",
         * set_ii.union(session.getNextII())); }
         */
        patient.setClassCode(RoleClass.PAT);
        // patient.setId(set_ii);
        return patient;
    }


    public Role newAssignedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ASSIGNED);
        return role;
    }


    public Role newAgent(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.AGNT);

        return role;
    }


    public Role newContact(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CON);
        return role;
    }


    public Role newEmergencyContact(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ECON);
        return role;
    }


    public Role newNextOfKin(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.NOK);
        return role;
    }


    public Role newSigningAuthority(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SGNOFF);
        return role;
    }


    public Role newGuardian(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.GUARD);
        return role;
    }


    public Role newCitizen(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CIT);
        return role;
    }


    public Role newCoveredParty(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.COVPTY);
        return role;
    }


    public Role newResearchInvestigator(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CRINV);
        return role;
    }


    public Role newResearchSponsor(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CRSPNSR);
        return role;
    }


    public Employee newEmployee(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Employee employee = new Employee();
        employee.setCode(ce);
        employee.setPlayerEntity(entity);
        employee.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { employee.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); employee.setId(
         * set_ii.union(session.getNextII())); }
         */
        employee.setClassCode(RoleClass.EMP);
        return employee;
    }


    public Role newSysRole(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role sysRole = new Role();
        sysRole.setCode(ce);
        sysRole.setPlayerEntity(entity);
        sysRole.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { employee.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); employee.setId(
         * set_ii.union(session.getNextII())); }
         */
        sysRole.setClassCode(RoleClass.SYSROLE);
        return sysRole;
    }


    public Employee newMilitaryPerson(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Employee employee = new Employee();
        employee.setCode(ce);
        employee.setPlayerEntity(entity);
        employee.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { employee.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); employee.setId(
         * set_ii.union(session.getNextII())); }
         */
        employee.setClassCode(RoleClass.MIL);
        return employee;
    }


    public Role newGuarantor(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.GUAR);
        return role;
    }


    public LicensedEntity newLicensedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        LicensedEntity licensedEntity = new LicensedEntity();
        licensedEntity.setCode(ce);
        licensedEntity.setPlayerEntity(entity);
        licensedEntity.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { licensedEntity.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); licensedEntity.setId(
         * set_ii.union(session.getNextII())); }
         */
        licensedEntity.setClassCode(RoleClass.LIC);
        return licensedEntity;
    }


    public LicensedEntity newNotaryPublic(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        LicensedEntity licensedEntity = new LicensedEntity();
        licensedEntity.setCode(ce);
        licensedEntity.setPlayerEntity(entity);
        licensedEntity.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { licensedEntity.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); licensedEntity.setId(
         * set_ii.union(session.getNextII())); }
         */
        licensedEntity.setClassCode(RoleClass.NOT);
        return licensedEntity;
    }


    public LicensedEntity newHealthcareProvider(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        LicensedEntity licensedEntity = new LicensedEntity();
        licensedEntity.setCode(ce);
        licensedEntity.setPlayerEntity(entity);
        licensedEntity.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { licensedEntity.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); licensedEntity.setId(
         * set_ii.union(session.getNextII())); }
         */
        licensedEntity.setClassCode(RoleClass.PROV);
        return licensedEntity;
    }


    public Role newPayee(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.PAYEE);
        return role;
    }


    public Role newPayor(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.PAYOR);
        return role;
    }


    public Role newPolicyHolder(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.POLHOLD);
        return role;
    }


    public Role newQualifiedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.QUAL);
        return role;
    }


    public Role newResearchSubject(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.RESBJ);
        return role;
    }


    public Role newSponsor(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SPNSR);
        return role;
    }


    public Role newStudent(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.STD);
        return role;
    }


    public Role newUnderwriter(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.UNDWRT);
        return role;
    }


    public Role newPersonalRelationship(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.PRS);
        return role;
    }


    public Access newAccess(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Access access = new Access();
        access.setCode(ce);
        access.setPlayerEntity(entity);
        access.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { access.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); access.setId(
         * set_ii.union(session.getNextII())); }
         */
        access.setClassCode(RoleClass.ACCESS);
        return access;
    }


    public Role newBirthplace(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.BIRTHPL);
        return role;
    }


    public Role newDistributedMaterial(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.DST);
        return role;
    }


    public Role newRetailedMaterial(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.RET);
        return role;
    }


    public Role newExposedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.EXPR);
        return role;
    }


    public Role newHeldEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.HLD);
        return role;
    }


    public Role newHealthChart(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.HLTHCHRT);
        return role;
    }


    public Role newManufacturedProduct(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.MANU);
        return role;
    }


    public Role newTherapeuticAgent(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.THER);
        return role;
    }


    public Role newMaintainedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.MNT);
        return role;
    }


    public Role newOwnedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.OWN);
        return role;
    }


    public Role newRegulatedProduct(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.RGRP);
        return role;
    }


    public Role newServiceDeliveryLocation(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SDLOC);
        return role;
    }


    public LicensedEntity newDedicatedServiceDeliveryLocation(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        LicensedEntity licensedEntity = new LicensedEntity();
        licensedEntity.setCode(ce);
        licensedEntity.setPlayerEntity(entity);
        licensedEntity.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { licensedEntity.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); licensedEntity.setId(
         * set_ii.union(session.getNextII())); }
         */
        licensedEntity.setClassCode(RoleClass.DSDLOC);
        return licensedEntity;
    }


    public Role newIncidentalServiceDeliveryLocation(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ISDLOC);
        return role;
    }


    public Role newTerritory(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.TERR);
        return role;
    }


    public Role newWarrantedProduct(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.WRTE);
        return role;
    }


    public Role newGeneralization(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.GEN);
        return role;
    }


    public Role newGeneric(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.GRIC);
        return role;
    }


    public Role newInstance(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.INST);
        return role;
    }


    public Role newSubsumer(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SUBS);
        return role;
    }


    public Role newSubsumedBy(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SUBY);
        return role;
    }


    public Role newContent(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CONT);
        return role;
    }


    public Role newIngredient(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.INGR);
        return role;
    }


    public Role newActiveIngredient(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ACTI);
        return role;
    }


    public Role newActiveMoiety(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ACTM);
        return role;
    }


    public Role newAdditive(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ADTV);
        return role;
    }


    public Role newBaseIngredient(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.BASE);
        return role;
    }


    public Role newInactiveIngredient(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.IACT);
        return role;
    }


    public Role newColorAdditive(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.COLR);
        return role;
    }


    public Role newFlavorAdditive(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.FLVR);
        return role;
    }


    public Role newPreservative(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.PRSV);
        return role;
    }


    public Role newStabilizer(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.STBL);
        return role;
    }


    public Role newLocatedEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.LOCE);
        return role;
    }


    public Role newStoredEntity(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.STOR);
        return role;
    }


    public Role newMember(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.MBR);
        return role;
    }


    public Role newPart(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.PART);
        return role;
    }


    public Role newSpecimen(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.SPEC);
        return role;
    }


    public Role newAliquot(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ALQT);
        return role;
    }


    public Role newIsolate(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.ISLT);
        return role;
    }


    public Role newCareGiver(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CAREGIVER);
        return role;
    }


    public Role newCaseSubject(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.CASESBJ);
        return role;
    }


    public Role newInvestigatedSubject(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        /*
         * if(set_ii == null || set_ii.isNull().isTrue() ||
         * set_ii.isEmpty().isTrue()) { role.setId(
         * dataTypeFactory.newSET_II(session.getNextII())); } else {
         * validation.validateOID(set_ii); role.setId(
         * set_ii.union(session.getNextII())); }
         */
        role.setClassCode(RoleClass.INVSBJ);
        return role;
    }


    public Role newClinicIndex(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        role.setClassCode(RoleClass.CLINICINDEX);
        return role;
    }


    public Role newClinicGroup(CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii) throws Hl7Exception
    {
        Role role = new Role();
        role.setCode(ce);
        role.setPlayerEntity(entity);
        role.setScoperEntity(entity1);
        role.setClassCode(RoleClass.CLINICGROUP);
        return role;
    }


    public Role makeReference(ReferenceModifier referencemodifier, CS cs, CE ce, Hl7Entity entity, Hl7Entity entity1, SET_II set_ii, int i)
        throws Hl7Exception
    {
        Object obj = null;

        if (cs != null && cs.equal(RoleClass.STBL).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.STBL);
        }
        else if (cs != null && cs.equal(RoleClass.FLVR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.FLVR);
        }
        else if (cs != null && cs.equal(RoleClass.CONT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CONT);
        }
        else if (cs != null && cs.equal(RoleClass.ASSIGNED).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ASSIGNED);
        }
        else if (cs != null && cs.equal(RoleClass.EMP).isTrue())
        {
            obj = new Employee(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.EMP);
        }
        else if (cs != null && cs.equal(RoleClass.POLHOLD).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.POLHOLD);
        }
        else if (cs != null && cs.equal(RoleClass.WRTE).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.WRTE);
        }
        else if (cs != null && cs.equal(RoleClass.PRS).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PRS);
        }
        else if (cs != null && cs.equal(RoleClass.RET).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.RET);
        }
        else if (cs != null && cs.equal(RoleClass.GRIC).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.GRIC);
        }
        else if (cs != null && cs.equal(RoleClass.AGNT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.AGNT);
        }
        else if (cs != null && cs.equal(RoleClass.SPNSR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SPNSR);
        }
        else if (cs != null && cs.equal(RoleClass.HLD).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.HLD);
        }
        else if (cs != null && cs.equal(RoleClass.DST).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.DST);
        }
        else if (cs != null && cs.equal(RoleClass.EXPR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.EXPR);
        }
        else if (cs != null && cs.equal(RoleClass.GUAR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.GUAR);
        }
        else if (cs != null && cs.equal(RoleClass.PAYEE).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PAYEE);
        }
        else if (cs != null && cs.equal(RoleClass.STD).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.STD);
        }
        else if (cs != null && cs.equal(RoleClass.NOT).isTrue())
        {
            obj = new LicensedEntity(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.NOT);
        }
        else if (cs != null && cs.equal(RoleClass.PRSV).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PRSV);
        }
        else if (cs != null && cs.equal(RoleClass.CASESBJ).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CASESBJ);
        }
        else if (cs != null && cs.equal(RoleClass.QUAL).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.QUAL);
        }
        else if (cs != null && cs.equal(RoleClass.NOK).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.NOK);
        }
        else if (cs != null && cs.equal(RoleClass.GEN).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.GEN);
        }
        else if (cs != null && cs.equal(RoleClass.LOCE).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.LOCE);
        }
        else if (cs != null && cs.equal(RoleClass.GUARD).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.GUARD);
        }
        else if (cs != null && cs.equal(RoleClass.MIL).isTrue())
        {
            obj = new Employee(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.MIL);
        }
        else if (cs != null && cs.equal(RoleClass.RGRP).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.RGRP);
        }
        else if (cs != null && cs.equal(RoleClass.ADTV).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ADTV);
        }
        else if (cs != null && cs.equal(RoleClass.CRINV).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CRINV);
        }
        else if (cs != null && cs.equal(RoleClass.CIT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CIT);
        }
        else if (cs != null && cs.equal(RoleClass.ALQT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ALQT);
        }
        else if (cs != null && cs.equal(RoleClass.SPEC).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SPEC);
        }
        else if (cs != null && cs.equal(RoleClass.ISDLOC).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ISDLOC);
        }
        else if (cs != null && cs.equal(RoleClass.IDENT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.IDENT);
        }
        else if (cs != null && cs.equal(RoleClass.CRSPNSR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CRSPNSR);
        }
        else if (cs != null && cs.equal(RoleClass.COVPTY).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.COVPTY);
        }
        else if (cs != null && cs.equal(RoleClass.OWN).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.OWN);
        }
        else if (cs != null && cs.equal(RoleClass.PAT).isTrue())
        {
            obj = new Patient(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PAT);
        }
        else if (cs != null && cs.equal(RoleClass.BIRTHPL).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.BIRTHPL);
        }
        else if (cs != null && cs.equal(RoleClass.CON).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CON);
        }
        else if (cs != null && cs.equal(RoleClass.CAREGIVER).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CAREGIVER);
        }
        else if (cs != null && cs.equal(RoleClass.PROV).isTrue())
        {
            obj = new LicensedEntity(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PROV);
        }
        else if (cs != null && cs.equal(RoleClass.ISLT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ISLT);
        }
        else if (cs != null && cs.equal(RoleClass.PART).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PART);
        }
        else if (cs != null && cs.equal(RoleClass.LIC).isTrue())
        {
            obj = new LicensedEntity(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.LIC);
        }
        else if (cs != null && cs.equal(RoleClass.MBR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.MBR);
        }
        else if (cs != null && cs.equal(RoleClass.COLR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.COLR);
        }
        else if (cs != null && cs.equal(RoleClass.IACT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.IACT);
        }
        else if (cs != null && cs.equal(RoleClass.STOR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.STOR);
        }
        else if (cs != null && cs.equal(RoleClass.ACTM).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ACTM);
        }
        else if (cs != null && cs.equal(RoleClass.SGNOFF).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SGNOFF);
        }
        else if (cs != null && cs.equal(RoleClass.INVSBJ).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.INVSBJ);
        }
        else if (cs != null && cs.equal(RoleClass.UNDWRT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.UNDWRT);
        }
        else if (cs != null && cs.equal(RoleClass.MANU).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.MANU);
        }
        else if (cs != null && cs.equal(RoleClass.ACTI).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ACTI);
        }
        else if (cs != null && cs.equal(RoleClass.MNT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.MNT);
        }
        else if (cs != null && cs.equal(RoleClass.ACCESS).isTrue())
        {
            obj = new Access(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ACCESS);
        }
        else if (cs != null && cs.equal(RoleClass.BASE).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.BASE);
        }
        else if (cs != null && cs.equal(RoleClass.SUBY).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SUBY);
        }
        else if (cs != null && cs.equal(RoleClass.THER).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.THER);
        }
        else if (cs != null && cs.equal(RoleClass.SUBS).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SUBS);
        }
        else if (cs != null && cs.equal(RoleClass.PAYOR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.PAYOR);
        }
        else if (cs != null && cs.equal(RoleClass.TERR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.TERR);
        }
        else if (cs != null && cs.equal(RoleClass.INGR).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.INGR);
        }
        else if (cs != null && cs.equal(RoleClass.SDLOC).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.SDLOC);
        }
        else if (cs != null && cs.equal(RoleClass.RESBJ).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.RESBJ);
        }
        else if (cs != null && cs.equal(RoleClass.INST).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.INST);
        }
        else if (cs != null && cs.equal(RoleClass.ECON).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.ECON);
        }
        else if (cs != null && cs.equal(RoleClass.HLTHCHRT).isTrue())
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.HLTHCHRT);
        }
        else if (cs != null && cs.equal(RoleClass.DSDLOC).isTrue())
        {
            obj = new LicensedEntity(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.DSDLOC);
        }
        else if (cs != null && cs.equals(RoleClass.CLINICINDEX))
        {
            obj = new LicensedEntity(referencemodifier);
            ((Role) (obj)).setClassCode(RoleClass.CLINICINDEX);
        }
        else
        {
            obj = new Role(referencemodifier);
            ((Role) (obj)).setClassCode(cs);
        }
        ((Role) (obj)).setCode(ce);
        ((Role) (obj)).setPlayerEntity(entity);
        ((Role) (obj)).setScoperEntity(entity1);
        
        return ((Role) (obj));
    }


    /*
     * private Role setEntity(Role role, String s, Entity entity) { if(entity ==
     * null) { role.setAttribute(s, null); } else { role.setAttribute(s,
     * entity); if(s.equals("PlayerEntity")) { Object obj =
     * (Collection)((EntityImpl)entity).getAttribute("PlayedRoles"); if(obj ==
     * null) obj = new ArrayList(); ((Collection) (obj)).add(role);
     * ((EntityImpl)entity).setAttribute("PlayedRoles", obj); } else { Object
     * obj1 = (Collection)((EntityImpl)entity).getAttribute("ScopedRoles");
     * if(obj1 == null) obj1 = new ArrayList(); ((Collection) (obj1)).add(role);
     * ((EntityImpl)entity).setAttribute("ScopedRoles", obj1); } } return role;
     * }
     */
  /*  public Rolelink newRolelink()
    {
        return new Rolelink();
    }*/
}
